import com.zjz.mapper.UserMapper;
import com.zjz.mapper.UserMapperImpl;
import com.zjz.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Mytest {
    @Test
    public  void  test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        UserMapperImpl userMapper = context.getBean("userMapper", UserMapperImpl.class);
        for (User user : userMapper.selectUser()) {
            System.out.println(user);
        }

    }



    @Test
    public void addTest(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserMapper userMapper = context.getBean("userMapper", UserMapper.class);

        userMapper.addUser(new User(8,"zjz8","12343234"));
    }


    @Test
    public void delete(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserMapper userMapper = context.getBean("userMapper", UserMapper.class);
        userMapper.deleteUser(8);

    }

}
